<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <video id='video'></video>
</body>
<script>
  navigator.mediaDevices.getUserMedia({
    audio: false,
    video: true
  }).then(stream => {
    console.log(stream)
    // handleStream(stream)
  })

  function handleStream(stream) {
    const video = document.querySelector('video')
    video.srcObject = stream
    video.onloadedmetadata = (e) => video.play()
  }
</script>

</html>